# Author:Zhang Yu
class MyType(type):
    def __init__(self,what,bases=None,dict=None):
        print("__mytype init")
        super(MyType, self).__init__(what,bases,dict)

    def __call__(self, *args, **kwargs):
        print("__mytype__ call")
        obj = self.__new__(self,*args,**kwargs)
        self.__init__(obj,*args,**kwargs)
class Foo:
    __metaclass__ = MyType
    def __init__(self,name):
        print("run __init__")
        self.name = name
    def __new__(cls,*args,**kwargs):
        print("run __new__")
        return object.__new__(cls)

if __name__ == '__main__':
    F = Foo("X")